<template>
  <div class="form">
    <el-form :inline="inline" :model="form" ref="form" label-width="100px">
      <el-form-item v-for="item of formLabel" :key="item.model" :label="item.label">
        <el-input v-model="form[item.model]" :placeholder="'请输入' + item.label" v-if="!item.type"></el-input>
        <el-select @change="selectClick" v-model="form[item.model]" placeholder="请选择" v-if="item.type === 'select'">
          <el-option v-for="items in item.opts" :key="items.value" :label="items.label" :value="items.value"> </el-option>
        </el-select>
        <el-switch @change="swichClick" v-model="form[item.model]" v-if="item.type === 'switch'"></el-switch>
        <el-date-picker v-model="form[item.model]" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" v-if="item.type === 'date'"> </el-date-picker>
      </el-form-item>
      <el-form-item><slot></slot></el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: '',
  props: {
    inline: Boolean, // 布尔默认为false
    form: Object,
    formLabel: Array
  },
  methods: {
    selectClick() {
      //   console.log(this.form.select)
    },
    swichClick() {
      //   console.log(this.form.switch)
    }
  },
  mouted() {
    console.log(this.form.keyword)
  }
}
</script>

<style lang="" scoped></style>
